#include "Persister.h"

Persister::Persister() {
}

Persister::~Persister() {
}

bool Persister::save(string taskId) {

    TEST_ST st1;
    memset(&st1, 0, sizeof(TEST_ST));

    SharedContext sharedContext1("TEST_ST1", sizeof(TEST_ST));
    sharedContext1.get(&st1);
    if (SHRT_MAX <= st1.cnt)
        st1.cnt = 0;

    Logger logg = Logger::getLogger(taskId);
    if (logg.isDebugEnabled()) {
        std::stringstream ss;
        ss << "Persister::save START " << st1.cnt;
        logg.debug(ss.str());
    }

    cout << "after set st1 " << st1.user << endl;

    strncpy(&(st1.user[0]), "TEST_USR1", 9);
    st1.cnt = st1.cnt + 1;
    sharedContext1.set(&st1);
    sharedContext1.end();

    return true;
}

